<button mat-raised-button color="accent" (click)="addRoom()">
    <mat-icon>add</mat-icon>{{i18n.lang.add}}
</button>
<button mat-raised-button color="accent" (click)="deleteRoom()" [disabled]="!selection.selected.length">
    <mat-icon>delete</mat-icon>{{i18n.lang.delete}}
</button>

<mat-form-field>
  <input matInput (keyup)="applyFilter($event.target.value)" [placeholder]="i18n.lang.search">
</mat-form-field>
<button mat-icon-button>
  <mat-icon>search</mat-icon>
</button>
<div class="mat-elevation-z8">
  <table mat-table [dataSource]="dataSource" matSort>
    <ng-container matColumnDef="select">
      <th mat-header-cell *matHeaderCellDef>
        <mat-checkbox
          (change)="$event ? masterToggle() : null"
          [checked]="selection.hasValue() && isAllSelected()"
          [indeterminate]="selection.hasValue() && !isAllSelected()"
        >
        </mat-checkbox>
      </th>
      <td mat-cell *matCellDef="let row">
        <mat-checkbox
          (click)="$event.stopPropagation()"
          (change)="$event ? selection.toggle(row) : null"
          [checked]="selection.isSelected(row)"
        >
        </mat-checkbox>
      </td>
    </ng-container>

    <ng-container matColumnDef="id">
      <th mat-header-cell *matHeaderCellDef mat-sort-header>ID</th>
      <td mat-cell *matCellDef="let element">{{ element.id}}</td>
    </ng-container>

    <ng-container matColumnDef="name">
      <th mat-header-cell *matHeaderCellDef mat-sort-header>{{i18n.lang.name}}</th>
      <td mat-cell *matCellDef="let element">{{ element.name }}</td>
    </ng-container>

    <ng-container matColumnDef="createTime" *ngIf="!isSmallScreen">
      <th mat-header-cell *matHeaderCellDef mat-sort-header>{{i18n.lang.createTime}}</th>
      <td mat-cell *matCellDef="let element">{{ element.createTime|date:'yyyy-MM-dd HH:mm'}}</td>
    </ng-container>

    <ng-container matColumnDef="lastActiveTime" *ngIf="!isSmallScreen">
      <th mat-header-cell *matHeaderCellDef mat-sort-header>{{i18n.lang.lastActiveTime}}</th>
      <td mat-cell *matCellDef="let element">{{ element.lastActiveTime|date:'yyyy-MM-dd HH:mm'}}</td>
    </ng-container>

    <ng-container matColumnDef="operation">
      <th mat-header-cell *matHeaderCellDef>{{i18n.lang.operation}}</th>
      <td mat-cell *matCellDef="let element">
        <button mat-button color="accent" (click)="copyLink(element)" >{{i18n.lang.copy}}</button>
        <button mat-button color="accent" (click)="openLink(element)">{{i18n.lang.open}}</button>
        <button mat-button color="accent" (click)="editRoom(element)">{{i18n.lang.edit}}</button>
      </td>
    </ng-container>

    <tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
    <tr
      mat-row
      *matRowDef="let row; columns: displayedColumns"
    ></tr>
  </table>

  <mat-paginator [pageSizeOptions]="[10, 30, 50]" showFirstLastButtons></mat-paginator>
</div>